<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <style>
        body {
          height: 3000px;
        }
        .mask {
          width: 100%;
          height: 100%;
          background-color: rgba(0, 0, 0, 0.5);
          position: fixed;
          top: 0;
          left: 0;
        }
        .login {
          box-sizing: border-box; /* 怪异盒子模型 */
          width: 300px;
          /* height: 300px; 后面去掉 */
          /* background-color: blue; */
          background-color: #fff;
          position: fixed;
          top: 50%;
          left: 50%;
          /* margin-left: -150px;
              margin-top: -150px; */
          transform: translate(-50%, -50%);
          padding: 40px;
        }
        .login input {
          box-sizing: border-box; /* 怪异盒子模型 */
          width: 100%;
          height: 40px;
          outline: none;
          margin-bottom: 20px;
          border: 1px solid #ddd;
        }
        .login input::placeholder {
          font-size: 18px;
          position: relative;
          top: 3px;
        }
        .login input:focus {
          border: 1px solid tomato;
          border-radius: 2px;
        }
        .login .login-button input {
          background-color: tomato;
          border: none;
          border-radius: 5px;
          color: #fff;
          margin: 0;
          cursor: pointer;
        }
        .login .close-button {
          /* content: ""; */
          position: absolute;
          right: 2px;
          top: 2px;
          width: 20px;
          height: 20px;
          background-color: #ddd;
          background-image: url(./images/close.png);
          background-size: 15px;
          background-repeat: no-repeat;
          background-position: center;
          /* background-size: cover; */
          cursor: pointer;
        }
      </style>
      
      <a href="">登录</a>
      <a href="">注册</a>
      <!-- 黑色半透明遮罩层 -->
      <div class="mask"></div>
      <!-- 登录 -->
      <div class="login">
        <span class="close-button"></span>
        <div class="user-name">
          <input type="text" placeholder="用户名" />
        </div>
        <div class="user-pwd">
          <input type="password" placeholder="密码" />
        </div>
        <div class="login-button">
          <input type="submit" value="登录" />
        </div>
      </div>
</body>
</html>